package iteratorbind.entity;

import java.util.Iterator;
import java.util.function.Consumer;

/**空迭代器
 * 什么都不做
 * 该迭代器的作用是"没作用"
 * 客户代码不用担心返回值是否为 null
 * @author yaojianfeng
 */
public class NullIterator implements Iterator {
    @Override
    public boolean hasNext() {
        return false;
    }

    @Override
    public Object next() {
        return null;
    }

    @Override
    public void remove() {
        throw new UnsupportedOperationException();
    }

    @Override
    public void forEachRemaining(Consumer action) {
        throw new UnsupportedOperationException();
    }
}
